package com.cd.music.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * @author yxl 余秀良
 * @version 1.0
 * @description: 收货地址表
 * @date 2018年03月02日  上午8:30
 * @address: 四川成都
 */
@Entity
@Table
public class DeliveryAddress {
    /**
     * id
     */
    @Id
    @Column(nullable = false, unique = true, length = 32)
    private String id;
    /**
     * 用户名
     */
    @Column(length = 30, nullable = false)
    private String userName;
    /**
     * 收货人联系电话
     */
    @Column(name = "phone", length = 11, nullable = false)
    @Pattern(regexp = "^(13[0-9]|15[0-3,5-9]|17[0135678]|18[0-9]|19[89])\\d{8}$")
    private String phone;
    /**
     * 省份
     */
    @Column(nullable = false, length = 100)
    private String province;
    /**
     * 城市
     */
    @Column(nullable = false, length = 100)
    private String city;
    /**
     * 县/区
     */
    @Column(nullable = false, length = 100)
    private String area;
    /**
     * 详细地址
     */
    @Column(nullable = false, length = 300)
    private String deliveryAddress;
    /**
     * 创建时间
     */
    @Column(name = "createTime", columnDefinition = "datetime default now()")
    private Date createTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public Date getCreateTime() {
        return createTime != null ? (Date) createTime.clone() : null;
    }

    public void setCreateTime(Date createTime) {
        if (createTime != null) {
            this.createTime = (Date) createTime.clone();
        }
    }

    public String getDeliveryAddress() {
        return deliveryAddress;
    }

    public void setDeliveryAddress(String deliveryAddress) {
        this.deliveryAddress = deliveryAddress;
    }
}
